ActionController::Routing::Routes.draw do |map|
  # 按照由上到下的顺序匹配URL
  
  #admin
  map.namespace(:admin) do |admin|
    admin.resources :users  
    admin.resources :posts  do |post|
      post.resources :comments
    end
    admin.resources :categories
    admin.resources :tags
  end
  
  # front
  map.root :controller => "posts"
  
  map.resources :tags
  map.resources :categories

  map.resources :posts do |post|
    post.resources :comments
  end
  

  map.connect ':controller/:action'
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end
